<?php
include_once 'Element.php';
include_once 'RadioButtonOption.php';

/**
 * RadioButton HTML
 */
class RadioButton extends Element {

    
    //properties
    private $selected = '';
    private $width;
    private $height;
    //events
    private $onChange;

    /**
     * @var SelectOption
     */
    private $options;

    /**
     * @var SelectGroup
     */
    private $groups = array();

    /**
     * Constructor
     * @param String $id Identificador del RadioButton
     */
    public function __construct($id) {
        parent::__construct($id);
    }

    /**
     * Genera Código HTML
     * @return string Código HTML
     */
    public function generate() {
        $html = array();
        $params = '';

        
            $options = $this->options;
            if (count($options)) {
                foreach ($options as $option) {
                    $html[] = (String) $option;
                }
            }
        

        $output = '';
        foreach ($html as $code) {
            $output = $output . $code;
        }
        return $output;
    }

    /**
     * Agrega opciones al grupo de RadioButtons
     * @param RadioButtonOption $option Objeto Opción
     */
    public function addOption(RadioButtonOption $option) {
        $option->setId(parent::getId());
        $this->options[] = $option;
    }

}

?>
